/*
 * morestdlib.h
 *
 *  Created on: Sep 6, 2008
 *      Author: pierre
 */

#ifndef MORESTDLIB_H_
#define MORESTDLIB_H_
#include <stdlib.h>
#include "lang/morestddef.h"
/**
 * local version of std::calloc
 * @param nmemb number of members
 * @param size size of each member
 * @return the allocated pointer or NULL if it failed
 */
extern Ptr Calloc(size_t nmemb, size_t size);
/**
 * local version of std::malloc
 * @parara size of memory do be allocated
 * @return the allocated pointer or NULL if it failed
 */
extern Ptr Malloc(size_t size);
/**
 * local version of std::free
 * @parara Ptr the pointer to be free
 */
extern void  Free(Ptr);
extern Ptr Realloc(Ptr, size_t size);

extern Ptr safeCalloc(size_t nmemb, size_t size);
extern Ptr safeMalloc(size_t size);
extern Ptr safeRealloc(Ptr, size_t size);


extern void exitAt(const char* filemane,int line,int status);
#define EXIT(status) exitAt(__FILE__,__LINE__,status)

#endif /* MORESTDLIB_H_ */
